package day10.CodeTransferTest;

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Test4 {
    public static void main(String[] args) {
        /*
        输出所有中文字符
        '\u4e00' 到 '\u9fa5'
        f9文件保存GBK
        f10文件保存UTF-8
         */

        String path = "/Users/hao/Desktop/abc/";
        String encoding;

        //System.out.println(Arrays.toString(c));
        try {
            f(path+"f9", "GBK");
            f(path+"f10", "UTF-8");
            System.out.println("传送成功");
        } catch (IOException e) {
            System.out.println("传送失败");
            e.printStackTrace();
        }
    }

    private static void f(String path, String encoding) throws IOException {
        OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(path), encoding);
        for(int i = 1, c = 0x4e00; c<= 0x9fa5; c++,i++){
            out.write(c);
            if(i % 30 == 0){
                out.write('\n');
            }
        }
        out.close();
    }

}
